<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="scripts/boot.js"></script>
</head>
<body style="border: 0px; margin: 0px; padding: 0px;width: 100%;height: 100%">
<div class="mini-toolbar" style="border-bottom:0;padding:0px;">
    <table style="width:100%;">
        <tr>
            <td>
            	选择年份：
        		<input id="select_year" class="mini-monthpicker" format="yyyy" tooltip="请选择年份" allowInput="false" style="width:100px;"/>年
				<a class="mini-button" iconCls="icon-search" onclick="search()">查询</a>
            </td>
        </tr>
    </table>           
</div>
<div class="mini-fit" >
<div id="container2" style="min-width: 310px; height: 100%;width: 100%;"></div>
</div>

<script type="text/javascript">

	mini.parse();
	var myDate = new Date();
	var year = myDate.getFullYear() - 1;
	var text = ''+year+'年会员购买力年度统计图';
	var data = [];
	
	var selectYear = mini.get("select_year");
	var myDate = new Date();
	var sm = myDate.getFullYear() + '-'+myDate.getMonth()+'';
	selectYear.setValue(sm);
	
	var options = {
		chart: {
	        type: 'column'
	    },
	    title: {
	        text: ''+year+'年会员购买力年龄段分布图'
	    },
	    xAxis: {
	        categories: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
	    },
	    yAxis: {
	        min: 0,
	        title: {
	            text: '人数'
	        }
	    },
	    plotOptions: {
	        column: {
	            pointPadding: 0.2,
	            borderWidth: 0
	        }
	    },
	    series:[
	    {
	        name: '月份人数',
	    }],
	    credits:{
	    	text:"",
	        href:"javascript:void(0);"
	    }
	};

	function search() {
		view();
	}
	
	function view() {
		var chart = $('#container2').highcharts(options);
		data = [];
		$.post("amount_year_view.do", {startTime: selectYear.getFormValue()}, function(info){
			data = $.parseJSON('[' + info + ']');
			chart = new Highcharts.Chart(options);
			chart.series[0].setData(data);
		}, "json");
	}

	function onKeyEnter(e) {
	    search();
	}

	$(document).ready(function(){
		view();
	});
</script>
</body>
</html>